package com.xzit.rcpyxt.controller;

import com.xzit.rcpyxt.constant.MessageCode;
import com.xzit.rcpyxt.dto.CourseDto;
import com.xzit.rcpyxt.dto.ResultModel;
import com.xzit.rcpyxt.service.CourseService;
import com.xzit.rcpyxt.utils.PageUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping(value = "/course")
public class CourseController {

    @Autowired
    private CourseService courseService;

    /**
     * 获取所有课程
     * @param courseDto
     * @return
     */
    @RequestMapping(value = "/findByCourseList", method = RequestMethod.GET)
    public ResultModel findByCourseList (CourseDto courseDto) {
        PageUtil byCourseList = courseService.findByCourseList(courseDto);
        return new ResultModel(MessageCode.OK, byCourseList);
    }

}
